using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RoslynEval
{
    public class ScriptEvalSystem
    {
        public ScriptEval[] evals;

        public ScriptEvalSystem(String[] equations, String[] variableNames)
        {
            evals = Functional.Maps.ParallelMap(equations, x => new ScriptEval(x, variableNames));
        }

        public Double[] CallAssemblies(Double[] variableValues)
        {
            return Functional.Maps.ParallelMap(evals, x => x.Eval(variableValues));
        }

        public static Func<Double[], Double[]> CreateEvalSystemFunction(String[] inEquations, String[] variableNames)
        {
            ScriptEvalSystem evalSystem = new ScriptEvalSystem(inEquations, variableNames);
            return (Double[] variableValues) => evalSystem.CallAssemblies(variableValues);
        }
    }
}